Appearance
HDU 6035 Colorful Tree · 多校(2017 多校第一场 1003)
题目描述
There is a tree with
The path between each two different nodes is unique, of which we define the value as the number of different colors appearing in it.
Calculate the sum of values of all paths on the tree that has
输入格式
The input contains multiple test cases.
For each test case, the first line contains one positive integer
Next line contains
Each of the next
It is guaranteed that these edges form a tree.
输出格式
For each test case, output Case #x: y in one line (without quotes), where
样例
样例 1
输入
text
3
1 2 1
1 2
2 3
6
1 2 1 3 2 1
1 2
1 3
2 4
2 5
3 6输出
text
Case #1: 6
Case #2: 29